package com.woniuxy.controller;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.woniuxy.entity.WareHousing;
import com.woniuxy.service.WarehousingService;

@RestController //所有数据默认以json返回
@RequestMapping("/warehousing")
public class WareHousingController {
	@Autowired 
	private WarehousingService warehousingService;
	
	@GetMapping("/find")
	public List<WareHousing> findWareHousing() {
		return warehousingService.findWareHousing();
	}
	
	@RequestMapping("/detail")
	public List<WareHousing> findWareHousingDeatilById(String worder) {
		return warehousingService.findWareHousingDeatilById(worder);
	}
	
	@RequestMapping("/insert")
	public String insertWarehousing(WareHousing wareHousing){
		int i=warehousingService.insertWarehousing(wareHousing);
		if (i==1) {
			return "success";
		}else{
			return "false";
		}
	}
	@RequestMapping("/cgname")
	public List<WareHousing> findWareHousingByCgname(String cgname) {
		return warehousingService.findWareHousingByCgname(cgname);
		
	}
	@RequestMapping("/update")
	public String updateWarehousing(String worder){
		int i=warehousingService.updateWarehousing(worder);
		if (i==1) {
			return "success";
		}else{
			return "false";
		}
	}
	@RequestMapping("/update_tp")
	public String updateWarehousing_tp(String worder) {
		int i=warehousingService.updateWarehousing_tp(worder);
		if (i==1) {
			return "success";
		}else{
			return "false";
		}
	}
	@RequestMapping("/delete")
	public String deleteWarehousing(String worder){
		int i=warehousingService.deleteWarehousing(worder);
		if (i==1) {
			return "success";
		}else{
			return "false";
		}
	}
	
}
